package com.iot08.admin.enums;

/**
 * @author cwj
 * @description
 * @date 2025/4/20 17:02
 **/

public enum PayOrderTypeEnum {

    VIP_MEMBER("会员",0),
    GOLD_COIN("金币",1);

    private String key;

    private int value;

    PayOrderTypeEnum() {
    }

    PayOrderTypeEnum(String key, int value) {
        this.key = key;
        this.value = value;
    }

    PayOrderTypeEnum(String key) {
        this.key = key;
    }

    public String getKey() {
        return key;
    }

    public int getValue() {
        return value;
    }

    public static PayOrderTypeEnum getEnumByKey(String key) {
        for(PayOrderTypeEnum payOrderTypeEnum:PayOrderTypeEnum.values()){
            if(payOrderTypeEnum.getKey().equals(key)) {
                return payOrderTypeEnum;
            }
        }
        return null;
    }

    public static Integer getValueBykey(String key) {
        for(PayOrderTypeEnum payOrderTypeEnum:PayOrderTypeEnum.values()){
            if(payOrderTypeEnum.getKey().equals(key)) {
                return payOrderTypeEnum.getValue();
            }
        }
        return null;
    }

    public static PayOrderTypeEnum getEnumByValue(Integer value){
        for(PayOrderTypeEnum payOrderTypeEnum:PayOrderTypeEnum.values()){
            if(payOrderTypeEnum.getValue() == value) {
                return payOrderTypeEnum;
            }
        }
        return null;
    }

    public static String getKeyByValue(int value){
        for(PayOrderTypeEnum payOrderTypeEnum:PayOrderTypeEnum.values()){
            if(payOrderTypeEnum.getValue() == value) {
                return payOrderTypeEnum.getKey();
            }
        }
        return null;
    }
}
